package com.yuyou.tas.lesson.mapper;

import com.yuyou.tas.service.api.lesson.dto.LessonClassStudentPageDTO;
import com.yuyou.tas.service.api.lesson.dto.StudentDetailDTO;
import com.yuyou.tas.service.api.lesson.dto.StudentPageDTO;
import com.yuyou.tas.service.api.lesson.entity.Student;
import com.yuyou.tas.util.bean.Pagination;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface StudentMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Student record);

    Student selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Student record);
    
    Student selectByOrgan7OId(@Param(value="oId") Long oId,@Param(value="authOrganizationId") Long authOrganizationId);
    
    List<Student> findByOId(@Param(value="oId") Long oId);

    List<Student> selectByOrganId(@Param(value = "authOrganizationId") Long authOrganizationId);

    Student selectByStudentNo(@Param(value = "studentNo") String studentNo);
    
    Student selectStudentByOrganIdStuNo(@Param(value = "organId") Long organId, @Param(value = "stuNo") String stuNo);
    
    /**
     * 分页
     * @param queryPgn
     * @return
     */
    int findLessonClassStudentCount(Pagination<LessonClassStudentPageDTO> queryPgn);
    
    /**
     * 分页
     * @param queryPgn
     * @return
     */
    List<LessonClassStudentPageDTO> findLessonClassStudentPageList(Pagination<LessonClassStudentPageDTO> queryPgn);
    
    /**
     * 学生列表分页
     * @param queryPgn
     * @return
     */
	public int findStudentCount(Pagination<StudentPageDTO> queryPgn);

	/**
	 * 学生列表分页
	 * @param queryPgn
	 * @return
	 */
	public List<StudentPageDTO> findStudentPageList(Pagination<StudentPageDTO> queryPgn);
    
    /**
     * 查出需要同步学生记录
     * @return
     */
    List<Student> findNeedSycnClassStudent(@Param(value = "createTime") String createTime);
    
    /**
     * 学生详情
     * @param id
     * @param authOrganizationId
     * @return
     */
    public StudentDetailDTO selectByOrgan7Id(@Param(value = "id")Long id,@Param(value = "authOrganizationId")Long authOrganizationId);
    
    /**
     * 根据名字和手机号码查询
     * @param name
     * @param phoneNo
     * @return
     */
    List<Student> selectByName7Phone(@Param(value = "name")String name, @Param(value = "phoneNo")String phoneNo);

    /**
     * 根据机构id，名字，手机号查询
     * @param authOrganizationId
     * @param name
     * @param phoneNo
     * @return
     */
    Student selectByOrganIdPhoneName(@Param(value = "authOrganizationId")Long authOrganizationId, @Param(value = "phoneNo")String phoneNo, @Param(value = "name")String name);
    
}